/**
 * Created by Administrator on 2017/3/27.
 */
/**
 * Created by Administrator on 2017/3/27.
 */
app.controller('regitCtr',
    ['$scope','$location', function ($scope,$location) {
        $scope.submitRegist = function() {
            $scope.yzm=false;//验证码是否正确加判断验证成功后
            $.post("http://172.19.32.67:8080/register",{Phone:phone,password:pwd,phone:phone},function(result){
                if(result.code==1){
                    $scope.registMsg=result.msg
                }else if(result.code==0){
                    $scope.registMsg=result.msg
                }
            },function (erro) {
            });
        }
}]);

//匹配密码指令
app.directive('pwCheck', function () {
    return {
        require: 'ngModel',
        link: function (scope, elem, attrs, ctrl) {
            var firstPassword = '#' + attrs.name;
            var confirmPassword='#'+attrs.pwCheck;
            elem.add(firstPassword).on('mouseout', function () {
                scope.$apply(function () {
                    ctrl.$setValidity('pwmatch', $(confirmPassword).val() === $(firstPassword).val());
                });
            });
        }
    }
});





